Skip to content

Conversation

@zvenigorodsky
Copy link

Fix: containers/podman#26197

When loading images, exit archive checks when receiving ENOSPC error, and display a clearer exit message for the user.

tests for podman at: containers/podman#27374

@github-actions github-actions bot added the common Related to "common" package label Oct 26, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Oct 26, 2025
@podmanbot
Copy link

✅ A new PR has been created in buildah to vendor these changes: containers/buildah#6452

@zvenigorodsky
Copy link
Author

zvenigorodsky commented Oct 26, 2025

Hey, I saw the issue containers/podman#26197 is stale, and decided to look into it.

Looked at zhengkezhou1's PR and researched about fmt.Errorf.

It does implement the unwrap method on the error (https://pkg.go.dev/fmt#Errorf) , and errors.Is does call the unwrap on fmt.Errorf (https://pkg.go.dev/errors#Is)

@zvenigorodsky
Copy link
Author

Tested this by creating a mounted filesystem with minimal storage and pointed store.graphroot to said filesystem,
works as intended

@zvenigorodsky zvenigorodsky changed the title common: abort load on ENOSPEC and output clear error common: abort load on ENOSPC and output clear error Oct 26, 2025
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

As I noted on containers/common#2446 (review) I don't think this can work because the chroot extraction and thus ENOSPC can happen in a subprocess so the error is just a string not the actual ENOSPC object so this cannot match I believe.

Can you provide the full reproducer you used to test this patch?

logrus.Debugf("Error loading %s (%s): %v", path, transportName, err)

if errors.Is(err, syscall.ENOSPC){
return nil, fmt.Errorf("no space left on device")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do do that, that throws away the full error context, i.e. you don't even know which file was attempted to write.

This must still return err.

@mtrmac
Copy link
Contributor

mtrmac commented Oct 30, 2025

can happen in a subprocess

(Note that this is platform-specific; testing on macOS or Windows would not show this.)

@zvenigorodsky
Copy link
Author

zvenigorodsky commented Oct 30, 2025

I forgot about other platforms, I tested this on a fedora 41 by creating a filesystem with minimal storage and pointing graphroot to the filesystem with a config file.

Here's a bash script that basically reproduces the setting:

#!/bin/bash

USER=$(whoami)

dd if=/dev/zero of=temp_storage bs=1M count=128
mkfs -t ext4 temp_storage
mkdir temp_storage_fs

sudo mount temp_storage temp_storage_fs
sudo chown $USER:$USER temp_storage_fs

cat > custom.conf <<EOF
[storage]
graphroot="$PWD/temp_storage_fs"
EOF

go mod edit -replace go.podman.io/common=github.com/zvenigorodsky/container-libs/common@main

go mod tidy

go mod vendor

make bin/podman 

# You can replace with any image that will be larger than 128Mb
HEAVY_IMAGE=quay.io/openshift-release-dev/ocp-release:4.20.2-ppc64le

./bin/podman pull $HEAVY_IMAGE 

./bin/podman save $HEAVY_IMAGE -o image.tar

export CONTAINERS_STORAGE_CONF="$PWD/custom.conf" 

./bin/podman load -i image.tar

Comment on lines 117 to 120
if errors.As(err, &pathErr) &&
!errors.Is(err, syscall.ENOTDIR) &&
!errors.Is(err, syscall.ENOENT) {
return nil, fmt.Errorf("no space left on device: %s", pathErr.Path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s just guessing, and discarding the original cause.

@zvenigorodsky zvenigorodsky force-pushed the main branch 2 times, most recently from a5d33fc to c8685cd Compare November 1, 2025 00:41
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Nov 1, 2025
Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still discarding the original error value [maybe we would want to modify the text, but it is still valuable to retain the regional error so that errors.As works higher in the stack], and not handling chrootarchive; both from the very first #419 (comment) .

@Luap99
Copy link
Member

Luap99 commented Nov 4, 2025

Note that I couldn't get go mod edit -replace go.podman.io/containers/common=github.com/zvenigorodsky/container-libs/common to work, it looked like container-libs/common is still not a drop-in replacement to containers/common (correct me if I'm wrong).

It works fine, after all we already use the monorepo in podman. It is your command which is wrong. The module name is go.podman.io/common (no containers)

https://github.com/containers/container-libs/blob/main/CONTRIBUTING_GO.md#testing-changes-in-a-dependent-repository

podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Nov 4, 2025
@zvenigorodsky
Copy link
Author

zvenigorodsky commented Nov 4, 2025

... and not handling chrootarchive; ...

Could you guide me in how can I test this for other platforms?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

podman image load fails with Error: payload does not match any of the supported image formats: on a system with low disk space

4 participants